const mongoose = require("mongoose");
var Stomp = require("stomp-client");
var Order = mongoose.model("order");
var destination = '/queue/ita_p4_complain_mq';
var client = new Stomp('10.222.232.152', 61613, '', '');

client.connect(function (sessionId) {
//???
    client.subscribe(destination, function (body, headers) {
        console.log('complaint c2a jms : oId+#+brand');
        console.log("Headers:" + headers);
        console.log("Body:" + body);
        var str=body.split("#");
        var order = new Order();
        order.oId=str[0];
        order.mBrand=str[1];
        order.oStatus=1;
        order.save(function (err) {
            console.log("ps:order.save");
        });
    });
//???
// client.publisher(destination,'john');
});